#ifndef STOPWATCH_H
#define STOPWATCH_H

/* ---<>-----------------------------------
        Includes
---------------------------------------- */
#include <sys/time.h>

/* ---<>-----------------------------------
        Stop Watch Class
---------------------------------------- */
class stopWatch
{
    public:
        double elapsed;
        stopWatch() { elapsed = 0; }
        ~stopWatch() {};
        void start() { gettimeofday(&t1,NULL); }
        double split()
        {
            gettimeofday(&t2,NULL);
            return t2.tv_sec-t1.tv_sec + (t2.tv_usec-t1.tv_usec)/1e6;
        }
    private:
        timeval t1, t2;
};

#endif // STOPWATCH_H
